package com.dant.effects
{
	import mx.effects.IEffectInstance;
	import mx.effects.TweenEffect;

	public class DefaultAdvancedPanelAction extends TweenEffect
	{

		/**
		 *  @private
		 */
		private static var AFFECTED_PROPERTIES:Array =
		[
			"width", "height",
			"explicitWidth", "explicitHeight",
			"percentWidth", "percentHeight",
			"x","y","left","right","top","bottom"
		];

		public var widthFrom:Number;
		public var widthTo:Number;
		public var heightFrom:Number;
		public var heightTo:Number;
		public var xFrom:Number;
		public var xTo:Number;
		public var yFrom:Number;
		public var yTo:Number;

		public function DefaultAdvancedPanelAction(target:Object=null)
		{
			super(target);
			instanceClass = DefaultAdvancedPanelActionInstance;
		}


	//--------------------------------------------------------------------------
	//
	//  Overridden methods
	//
	//--------------------------------------------------------------------------
 
		/**
		 *  @private
		 */
		override public function getAffectedProperties():Array /* of String */
		{
			return AFFECTED_PROPERTIES;
		}	

		/**
		 *  @private
		 */
		override protected function initInstance(instance:IEffectInstance):void
		{
			super.initInstance(instance);
			
			var minimizeInstance:DefaultAdvancedPanelActionInstance = DefaultAdvancedPanelActionInstance(instance);
	
			if (!isNaN(widthFrom))
				minimizeInstance.widthFrom = widthFrom;
			if (!isNaN(widthTo))
				minimizeInstance.widthTo = widthTo;
			if (!isNaN(heightFrom))
				minimizeInstance.heightFrom = heightFrom;
			if (!isNaN(heightTo))
				minimizeInstance.heightTo = heightTo;

			if (!isNaN(xFrom))
				minimizeInstance.xFrom = xFrom;
			if (!isNaN(xTo))
				minimizeInstance.xTo = xTo;
			if (!isNaN(yFrom))
				minimizeInstance.yFrom = yFrom;
			if (!isNaN(yTo))
				minimizeInstance.yTo = yTo;
		}
	}
}